package com.wnnight.wys.entity.repairs;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wnnight.wys.groupInterface.AddGroup;
import com.wnnight.wys.groupInterface.AlterGroup;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author rzh6230
 * 2022/8/27 17:08
 */
@Getter
@Setter
@ToString
@TableName(value = "repairs_type", keepGlobalPrefix = true)
public class RepairsType {
    @TableId(type = IdType.AUTO)
    @NotNull(message = "分类id不能为空", groups = AlterGroup.class)
    private Integer id;
    @NotBlank(message = "分类名称不能为空", groups = {AddGroup.class, AlterGroup.class})
    @Size(min = 1, max = 20, message = "分类名称20个字符之内", groups = {AddGroup.class, AlterGroup.class})
    private String name;
    @NotNull( message = "分类父id不能为空", groups = {AddGroup.class, AlterGroup.class})
    @Min(value = 0, message = "分类父id不能小于0", groups = {AddGroup.class, AlterGroup.class})
    private Integer parentId;
//    @NotNull( message = "分类位置标识不能为空", groups = {AddGroup.class, AlterGroup.class})
//    @Min(value = 0, message = "分类位置标识不能小于0", groups = {AddGroup.class, AlterGroup.class})
    private Integer placeMark;
    @TableField(exist = false)
    private List<RepairsType> sonType;
}
